<script src="../resources/run-after-layout-and-paint.js"></script>
<script>
    if (window.testRunner)
        testRunner.waitUntilDone();

    function onPause()
    {
        var videoElement = document.getElementById("fr").contentDocument.querySelector("video");
        runAfterLayoutAndPaint(function() {
            videoElement.currentTime = videoElement.duration * 0.50;
        });
    }

    function onSeeked()
    {
        if (window.testRunner)
            testRunner.notifyDone();
    }

    function frameLoaded()
    {
        var videoElement = document.getElementById("fr").contentDocument.querySelector("video");
        videoElement.addEventListener("pause", onPause, false);
        videoElement.addEventListener("seeked", onSeeked, false);
        // The MediaDocument has AUTOPLAY set, make sure we're paused.
        videoElement.pause();
    }
</script>
<p>
    This tests that in a standalone media document with audio content, the media element repaints correctly
    while playing.
</p>
<iframe src="content/silence.wav" id="fr" width=380 height=330 onload="frameLoaded()"></iframe>
<script>// To produce the same layout as before iframe was moved down to avoid rebaselines of different platforms.
// https://bugs.webkit.org/show_bug.cgi?id=54942
</script>
